<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${ctx}/assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="${ctx}/assets/css/index.css?v=2.3">
    <script>
     var signUrl2=location.href.split('#')[0];
     var advertId='${param.advertId}';
	if(signUrl2.indexOf("isappinstalled")>0){
		signUrl2=signUrl2.split('?')[0];
		location.href=signUrl2+"?advertId="+advertId;
	}
    </script>
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
     var linkJpg="http://m.zuoxinjiazhang.com/js/zuoxin.jpg";
var title='${picNews.title}';
var content="佐心，教家长做智慧父母。"+title+"新闻详情页";
    function goBack(){  
         location.href="${ctx}/index.jsp";
    }  
    </script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a onclick="goBack();">  <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        详情页
    </h1>

</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">

    <div class="am-container font-16 font-color-13 am-padding-top-sm font-bold">
        ${picNews.title}
    </div>
    <div class="am-padding-bottom-sm">
        <div class="am-g am-g-fixed am-margin-top-xs">
            <div class="am-u-sm-8 padding-left-xl">
                <i class="icon_50"></i> <span
                    class="font-color-15 am-margin-left-sm" >${picNews.counseName}</span>
                    <span class="font-color-14 border-right am-padding-right-sm" onclick="$('#my-code').modal('open')">佐心科技</span>
            </div>
            <div class="am-u-sm-4 font-color-15 am-text-right">
            ${picNews.addTimeStr}
            </div>
        </div>
        <div class="am-padding-sm ">
            <!-- <img class="width-100" src="${ctx}/assets/images/upload/icon_54.jpg"/> -->
        </div>
        <div class="am-container font-color-13 font-14">
            ${picNews.content}
        </div>
    </div>

    <div class="bg-white am-padding-top-sm am-padding-bottom-xs">
        <!-- 心理咨询平台-->
        <div class="icon_26 am-text-center font-color-12 ">
            心理咨询平台
        </div>
        <div class=" bg-gray am-margin-left-sm am-margin-right-sm am-margin-top-sm">
            <div class="am-g am-g-fixed  am-padding-top-sm border-1">
                <div class="am-u-sm-3 am-list-thumb am-padding-left-sm">
                    <a class="">
                        <img class="img-65"  id="personHead" src=""/>
                    </a>
                    <i class="icon_12"></i>
                </div>
                <div class=" am-u-sm-9 am-list-main">
                    <div class="am-list-item-hd font-color-main">
                       <span id="cName">  </span><i class="btn-3"><i class="btn-icon-zan"></i>
                        <span id="rGrade"></span>
                       </i>
                    </div>

                    <div class="font-12  font-color-11">
                      <span id="professional"></span>
                    </div>
                    <div class="font-14  font-color-main">
                       <span id="direction"> </span>
                    </div>
                </div>
                <div class="am-u-sm-12 am-margin-top-xs">
                    <div class="border-tops font-color-12 am-text-right am-padding-top-sm am-padding-bottom-sm prelative">
                        <i class="icon_52"></i><span onclick="window.location.href='gotoyuyuejsp?tel=${picNews.counseTel}'">去预约</span>
                    </div>
                </div>
            </div>
        </div>

        <!--相关评论-->
        <div class="icon_24 am-text-center font-color-13">
            相关评论
        </div>
        <div class="mark_list">

            <div class="am-list-news am-list-news-default ">

                <div class="am-list-news-bd am-margin-left-sm am-margin-right-sm">
                    <ul class="am-list">
                        

                    </ul>
                </div>
            </div>

            <!--<div class="icon_55"></div>-->
            <!--<div class="am-text-center font-14 font-color-15">暂无评论，快点击评论按钮，抢沙发吧！</div>-->
        </div>
    </div>
</section>

<footer data-am-widget="navbar" class="am-navbar am-cf am-navbar-default bg-white"
        id="">
    <div class="am-g   am-g-collapse am-padding-left-sm">
        <div class="am-u-sm-4 font-color-1 am-padding-right-sm" id="shouchang">
		<div class="btn-4"><span class="prelative"><i <c:if test="${isShouChang==0}">class="icon_48"</c:if> <c:if test="${isShouChang==1}">class="icon_48 cur"</c:if>></i>收藏</span></div>   
        </div>
        <div class="am-u-sm-4 am-padding-right-sm" onclick="showPop()">
            <div class="btn-4"><span class="prelative"><i class="icon_49" ></i>分享</span></div>
        </div>
        <div class="am-u-sm-4 am-padding-right-sm" id="btnmark">
            <div class="btn-4"><span class="prelative"><i class="icon_53"></i>评论</span></div>
        </div>
    </div>

</footer>

<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">评论</div>
        <div class="am-modal-bd">
            <textarea rows="3" id="pContent" class="mark_content am-modal-prompt-input"></textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>提交</span>
        </div>
    </div>
</div>
<!--二维码-->
<div class="am-modal am-modal-alert" tabindex="-1" id="my-code">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">长按微信二维码,<br/>关注佐心科技公众号</div>
        <div class="am-modal-bd">
            <img src="${ctx}/js/ewm.png" style="width:100%;height:100%">
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn">关闭</span>
        </div>
    </div>
</div>
<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>
<script>
	
	function showPop() {
    var t = $(document).height();

    if ($('#pop-share').length <= 0) {
        $('body').append(' <div class="mod-pop" id="pop-share" onclick="hidePop(\'#pop-share\')"> <span class="text-share"></span> </div>');
    };
    var $obj=$('#pop-share');
    $($obj).height(t).fadeIn();
	}
	
	function hidePop(e) {
    $(e).fadeOut();
	}

	$(function () {
		var counselorList=$.ajax({url:"myData?counseTel=${picNews.counseTel}",async:false});
        var jsonCounselor=JSON.parse(counselorList.responseText);
        
        if(jsonCounselor.resultCode=="0"){
        	$("#cName").text(jsonCounselor.counselor.counseName);
        	$("#rGrade").text(jsonCounselor.counselor.recommenGrade);
        	$("#professional").text(jsonCounselor.counselor.professional);
        	$("#direction").text(jsonCounselor.counselor.goodDirection);
        	$("#personHead").attr("src",jsonCounselor.counselor.personHead);
        }
    
    	//getPinglun
    	var pingLunList=$.ajax({url:"getPinglun?picNewsId=${picNews.id}",async:false});
    	var jsonPingLun=JSON.parse(pingLunList.responseText);
    	if(jsonPingLun.resultCode=="-1"){
    		$(".mark_list").html(" <div class='icon_55'></div>"+
            "<div class='am-text-center font-14 font-color-15'>暂无评论，快点击评论按钮，抢沙发吧！</div>");
    	}else if(jsonPingLun.resultCode=="0"){
    		var html="";
       		for(var i=0;i<jsonPingLun.pingLunList.length;i++){
       			html+="<li class='am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left'>";
				html+="<div class=' am-u-sm-12 am-list-main font-14 box'>";
				html+="	 <div class='width-60px'>";
                html+="	    <a class=''>";
                html+="	         <img class='img-50' src='"+jsonPingLun.pingLunList[i].headimgurl+"'/>";
                html+="	    </a>";
				html+="	 </div>";
				html+="<div class='box-1'>";
                html+=" <h3 class='am-list-item-hd font-color-main'>";
				html+=" <div class='am-g am-g-collapse'>";
				html+=" <div class='am-u-sm-8'><span class='font-color-14'>"+jsonPingLun.pingLunList[i].userName+"</span>";
				
				if(""!=jsonPingLun.pingLunList[0].beiUserId && null!=jsonPingLun.pingLunList[i].beiUserId){
					html+="<span class='font-color-16 am-margin-left-xs'>回复</span>";
					html+="<span class='font-color-14 am-margin-left-xs'>"+jsonPingLun.pingLunList[i].beiUserName+"</span>";
				}
				
				html+=" </div>";
				html+=" <div class='am-u-sm-4 font-color-16 font-12 padding-top-2pxs am-text-right'>";
				html+=" "+jsonPingLun.pingLunList[i].addTimeStr;
				html+=" </div>";
				html+=" </div>";
				html+=" </h3>";
				html+=" <div class='font-14 font-color-13 margin-top-5'>";
				html+=" "+jsonPingLun.pingLunList[i].content;
				html+=" </div>";
				html+=" <div class='am-text-right font-color-16 margin-top-5 '><span class='prelative'><i";
				html+=" class='icon_39' data-id='"+jsonPingLun.pingLunList[i].id+"' onclick='pinglun2();'></i>"+jsonPingLun.pingLunList[i].beiPingLcnt+"</span></div>";
				html+=" </div>";
				html+=" </div>";
				html+=" </li>";
       		}
       		$(".am-list").html(html);
    	}
    	
    	
    	$('.am-list').find('.icon_39').on('click', function() {
                    $('#my-prompt').modal({
                        relatedTarget: this,
                        onConfirm: function(options) {
                            var $link = $(this.relatedTarget);
                            var id=$link.data('id');
                           // var picNewsId=${picNews.id};
                            var content=$("#pContent").val();
                             location.href="${ctx}/goPinglun?id="+id+"&content="+content+"&picNewsId=${picNews.id}&advertId=${advertId}";
                        },
                        onCancel: function() {

                        }
                    });
        });
    	
        $('#btnmark').on('click', function () {
            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function (e) {
                    var content=$("#pContent").val();
                    location.href="${ctx}/goPinglun?content="+content+"&picNewsId=${picNews.id}&advertId=${advertId}";
                },
                onCancel: function (e) {
//                    alert('不想说!');
                }
            });
        });

        $("#shouchang").on('click', function () {
        
        	var baseResponse=$.ajax({url:"${ctx}/isLogin",async:false});
		  	var sendAuthCode=JSON.parse(baseResponse.responseText);
		   	if(sendAuthCode.resultCode!="0"){
		   		alert("用户长时间未操作，返回首页");
		   		location.href="${ctx}/index.html";
		   	}else{
		   		var baseResponse2=$.ajax({url:"${ctx}/goShouchang?picNewsId=${picNews.id}&type=1",async:false});
			  	var isShouchang=JSON.parse(baseResponse2.responseText);
				if(isShouchang.resultCode=="0"){
				   	if($(this).find("i.icon_48").hasClass("cur")){
	                	$(this).find("i.icon_48").removeClass("cur");
		            }else{
		            	$(this).find("i.icon_48").addClass("cur");
		            }
			   	}
		   	}
        });
    });
</script>
<div style="display:none">
<h3 id="menu-basic" style="display:none">基础接口</h3>    
<span class="desc"  style="display:none">判断当前客户端是否支持指定JS接口</span>    
<button class="btn btn_primary" id="checkJsApi"  style="display:none">checkJsApi</button>    
<h3 id="menu-share"  style="display:none">分享接口</h3>    
<span class="desc" >获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareTimeline2" >onMenuShareTimeline</button>    
<span class="desc"  style="display:none">获取“分享给朋友”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareAppMessage"  style="display:none">onMenuShareAppMessage</button>    
<span class="desc"  style="display:none">获取“分享到QQ”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareQQ"  style="display:none">onMenuShareQQ</button>    
<span class="desc"  style="display:none">获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</span>    
<button class="btn btn_primary" id="onMenuShareWeibo"  style="display:none">onMenuShareWeibo</button>       
<h3 id="menu-voice">音频接口</h3>    
<span class="desc">开始录音接口</span>    
<button class="btn btn_primary" id="startRecord2">startRecord</button>    
<span class="desc">停止录音接口</span>    
<button class="btn btn_primary" id="stopRecord">stopRecord</button>    
<span class="desc">播放语音接口</span>    
<button class="btn btn_primary" id="playVoice">playVoice</button>    
<span class="desc">暂停播放接口</span>    
<button class="btn btn_primary" id="pauseVoice">pauseVoice</button>    
<span class="desc">停止播放接口</span>    
<button class="btn btn_primary" id="stopVoice">stopVoice</button>    
<span class="desc">上传语音接口</span>    
<button class="btn btn_primary" id="uploadVoice">uploadVoice</button>    
<span class="desc">下载语音接口</span>    
<button class="btn btn_primary" id="downloadVoice">downloadVoice</button>    
<h3 id="menu-smart">智能接口</h3>    
<span class="desc">识别音频并返回识别结果接口</span>    
<button class="btn btn_primary" id="translateVoice">translateVoice</button>    
</div>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>   
<script>    
var nonceStr;
var timestamp;
var signature;
var appId;
htmlobj=$.ajax({url:"getSign?url="+location.href.split('#')[0],async:false});
var json=JSON.parse(htmlobj.responseText);
signature=json.signature; 
nonceStr=json.nonceStr; 
timestamp=json.timestamp; 
appId=json.appId; 
wx.config({    
debug: false,    
appId: appId,    
timestamp: timestamp,    
nonceStr: nonceStr,    
signature: signature,    
jsApiList: [        
'checkJsApi',    
'onMenuShareTimeline',    
'onMenuShareAppMessage',    
'onMenuShareQQ',    
'onMenuShareWeibo',    
'hideMenuItems',    
'showMenuItems',    
'hideAllNonBaseMenuItem',    
'showAllNonBaseMenuItem',    
'translateVoice',    
'startRecord',    
'stopRecord',    
'onRecordEnd',    
'playVoice',    
'pauseVoice',    
'stopVoice',    
'uploadVoice',    
'downloadVoice',    
'chooseImage',    
'previewImage',    
'uploadImage',    
'downloadImage',    
'getNetworkType',    
'openLocation',    
'getLocation',    
'hideOptionMenu',    
'showOptionMenu',    
'closeWindow',    
'scanQRCode',    
'chooseWXPay',    
'openProductSpecificView',    
'addCard',    
'chooseCard',    
'openCard'
]    
});    
</script>  
<script type="text/javascript">
wx.ready(function () {
// 1 判断当前版本是否支持指定 JS 接口，支持批量判断
document.querySelector('#checkJsApi').onclick = function () {
  wx.checkJsApi({
    jsApiList: [
      'getNetworkType',
      'previewImage'
    ],
    success: function (res) {
    }
  });
};
// 2. 分享接口
// 2.1 监听“分享给朋友”，按钮点击、自定义分享内容及分享结果接口
  wx.onMenuShareAppMessage({
	  title: title,
  desc: content,
	  link: window.location.href,
	  imgUrl: linkJpg,
    trigger: function (res) {
    },
    success: function (res) {
      alert('已分享');
    },
    cancel: function (res) {
      alert('已取消');
    },
    fail: function (res) {
    }
  });
// 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
  wx.onMenuShareTimeline({
	  title: title,
  desc: content,
	  link: window.location.href,
	  imgUrl: linkJpg,
    trigger: function (res) {
    },
    success: function (res) {
      alert('已分享');
    },
    cancel: function (res) {
      alert('已取消');
    },
    fail: function (res) {
    }
  });
// 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
  wx.onMenuShareQQ({
	  title: title,
  desc: content,
	  link: window.location.href,
	  imgUrl: linkJpg,
    trigger: function (res) {
    },
    complete: function (res) {
      alert(JSON.stringify(res));
    },
    success: function (res) {
      alert('已分享');
    },
    cancel: function (res) {
      alert('已取消');
    },
    fail: function (res) {
    }
  });
// 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
document.querySelector('#onMenuShareWeibo').onclick = function () {
  wx.onMenuShareWeibo({
	   title: title,
  desc: content,
	  link: '${ctx}/myzones.jsp',
	  imgUrl: linkJpg,
    trigger: function (res) {
      alert('用户点击分享到微博');
    },
    complete: function (res) {
      alert(JSON.stringify(res));
    },
    success: function (res) {
      alert('已分享');
    },
    cancel: function (res) {
      alert('已取消');
    },
    fail: function (res) {
      alert(JSON.stringify(res));
    }
  });
  alert('已注册获取“分享到微博”状态事件');
};
var shareData = {
  title: title,
  desc: content,
  link: window.location.href,
  imgUrl: linkJpg,
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
});
wx.error(function (res) {
});

</script>
</body>
</html>